/*
package com.huaxin.util;

import lombok.Data;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

public class list2Queun {

    public static void main(String[] args) {
        //测试数据
        List<DayData> items = new ArrayList<>();
//        for (int i = 1; i <= 30; i++) {
//            DayData bean = new DayData();
//            bean.setDay(i);
//            bean.setId(i <= 10 ? 123 : 456);
//            bean.setName(i <= 10 ? "asd" : "zxc");
//            items.add(bean);
//        }
//        DayData test = new DayData();
//        test.setDay(1);
//        test.setId(2);
//        test.setName("test");
//        items.add(test);
//        DayData test1 = new DayData();
//        test1.setDay(2);
//        test1.setId(2);
//        test1.setName("test1");
//        items.add(test1);
//        for (int i = 1; i <= 30; i++) {
//            DayData bean = new DayData();
//            bean.setDay(i);
//            bean.setId(i <= 10 ? 234 : 567);
//            bean.setName(i <= 10 ? "qwe" : "mnb");
//            items.add(bean);
//        }
        //开始
//        long s = System.currentTimeMillis();
        Map<Integer, List<DayData>> map = new HashMap<>();
        Map<Integer, List<DayData>> idMap = new TreeMap<>();
        AtomicInteger maxRow = new AtomicInteger(1);
        items.forEach(item -> {
            Integer day = item.getDay();
            Integer id = item.getId();
            if (map.containsKey(day)) {
                map.get(day).add(item);
            } else {
                map.put(day, new ArrayList<>(Collections.singletonList(item)));
            }
            if (idMap.containsKey(id)) {
                idMap.get(id).add(item);
            } else {
                idMap.put(id, new ArrayList<>(Collections.singletonList(item)));
            }
            int size = map.get(day).size();
            maxRow.set(Math.max(size, maxRow.get()));
        });
        int monthDay = 31; //对应月多少天
        Map<Integer, List<DayData>> allMap = new HashMap<>();
        Set<Integer> hasIds = new HashSet<>();
        for (int i = 0; i < maxRow.get(); i++) {
            List<DayData> days = new ArrayList<>();
            Map<Integer, DayData> dayMap = new HashMap<>();
            for (Integer id : idMap.keySet()) {
                if (hasIds.contains(id))
                    continue;
                List<DayData> list = idMap.get(id);
                for (DayData item : list) {
                    Integer day = item.getDay();
                    if (!dayMap.containsKey(day)) {
                        dayMap.put(day, item);
                        hasIds.add(id);
                    } else
                        break;
                }
            }
            for (int j = 0; j < monthDay; j++) {
                int tmpd = j + 1;
                DayData orDefault = dayMap.getOrDefault(tmpd, new DayData());
                orDefault.setDay(tmpd);
                days.add(orDefault);
            }
//            System.out.println("第" + (i + 1) + "行");
//            days.forEach(item -> {
//                System.out.print("[ day: " + item.getDay() + ", Id: " + item.getId() + ", name: " + item.getName() + "] ");
//            });
//            System.out.println("");
            allMap.put(i + 1, days);
        }
//        double e = (double) (System.currentTimeMillis() - s) / 1000;
//        System.out.println(e + "s");
    }
}

@Data
class DayData {

    private Integer day;

    private Integer Id;

    private String name;
}
*/
